﻿@using Orchard.ContentManagement

@{
    var userCanRegister = WorkContext.CurrentSite.As<Orchard.Users.Models.RegistrationSettingsPart>().UsersCanRegister;
    var enableLostPassword = WorkContext.CurrentSite.As<Orchard.Users.Models.RegistrationSettingsPart>().EnableLostPassword;
}

@if (Model.Title == "Access Denied") {
    <div class="alert alert-dismissable alert-danger">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <strong>@Html.TitleForPage(T("Access Denied").ToString())</strong>
        <p>@T("You do not have permission to complete your request.")</p>
    </div>
}

@if (Html.ValidationSummary() != null) {
    <div class="alert alert-dismissable alert-danger">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <strong>@T("Login was unsuccessful. Please correct the errors and try again.")</strong>
        <p>@Html.ValidationSummary()</p>
    </div>
}

<h1 class="page-title">@Html.TitleForPage((string)Model.Title)</h1>
<p>
    @T("Please enter your username and password.")
    @if (userCanRegister) { @Html.ActionLink(T("Register").Text, "Register", new { ReturnUrl = Request.QueryString["ReturnUrl"] }) @T(" if you don't have an account.") }
    @if (enableLostPassword) { <text> </text> @Html.ActionLink(T("Lost your Password?").Text, "RequestLostPassword") }
</p>

@using (Html.BeginFormAntiForgeryPost(Url.Action("LogOn", new { ReturnUrl = Request.QueryString["ReturnUrl"] }))) {
    <fieldset class="login-form group">
        <legend>@T("Account Information")</legend>
        <div>
            <label for="username-email">@T("Username")</label>
            @Html.TextBox("userNameOrEmail", "", new { id = "username-email", autofocus = "autofocus", @class = "validate[required]" })
            @Html.ValidationMessage("userNameOrEmail")
        </div>
        <div>
            <label for="password">@T("Password")</label>
            @Html.Password("password", null, new { @class = "validate[required]" })
            @Html.ValidationMessage("password")
        </div>
        <div class="checkbox">
            <label class="forcheckbox" for="remember-me">
                @Html.CheckBox("rememberMe", new { id = "remember-me" }) @T("Remember Me")
            </label>
        </div>
        <div>
            <button class="primaryAction" type="submit">@T("Sign In")</button>
        </div>
    </fieldset>
}